package com.steven.im.base;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.WindowManager;

import com.jakewharton.rxbinding.view.RxView;
import com.steven.im.myinterface.ViewClickListen;
import com.steven.im.utils.StatusBarUtil;
import com.umeng.analytics.MobclickAgent;

import java.util.concurrent.TimeUnit;

import butterknife.ButterKnife;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.subscriptions.CompositeSubscription;

/**
 * Created by Steven on 2019/1/3.
 */
public abstract class BaseActivity extends FragmentActivity {


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //禁止横竖屏切换
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        //设置状态栏全透明
        StatusBarUtil.setStatusBar(this, true);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
        //设置布局
        setContentView(intiLayout());
        //绑定组件
        ButterKnife.bind(this);
        //设置状态栏颜色,以及是否为全屏
        setTitleBarColor();
        //初始化控件
        initView();
        //添加监听
        setListen();
        //设置数据
        initData();
    }

    @Override
    protected void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }

    public abstract void setListen();

    /**
     * 设置状态栏颜色
     */
    public abstract void setTitleBarColor();

    /**
     * 设置布局
     *
     * @return id
     */
    public abstract int intiLayout();

    /**
     * 初始化布局
     */
    public abstract void initView();

    /**
     * 设置数据
     */
    public abstract void initData();


}
